/**
 * 
 */
package com.waylau.spring.boot.blog.service;

import com.waylau.spring.boot.blog.domain.Browse;
import com.waylau.spring.boot.blog.domain.Genre;
import com.waylau.spring.boot.blog.repository.BrowseRepository;
import com.waylau.spring.boot.blog.repository.GenreRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Gener 服务.
 * 
 * @since 1.0.0 2017年3月30日
 * @author <a href="https://waylau.com">Way Lau</a>
 */
@Service
public class BrowseServiceImpl implements BrowseService {

	@Autowired
	private BrowseRepository browseRepository;

	@Override
	public Browse save(Browse browse) {
		return browseRepository.save(browse);
	}

	@Override
	public List<Browse> findTop50ByUser(Long userId) {
		return browseRepository.findTop50ByUserIdOrderByTimeDesc(userId);
	}
}
